//
//  LTvisitorView.swift
//  textweibo
//
//  Created by 李 付涛 on 2017/3/19.
//  Copyright © 2017年 江苏岳创信息科技有限公司. All rights reserved.
//

import UIKit

class LTvisitorView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
     lazy var iconImage:UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_smallicon"))
    
    /// 遮罩图像
    lazy var MaskiconImage:UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_mask_smallicon"))
    
     lazy var houseIconImage:UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_house"))
    
    /// 提示标签
     lazy var topLable:UILabel = UILabel.cz_label(withText: "关注一些人，回这里看看有什么惊喜关注一些人，回这里看看有什么惊喜", fontSize: 14, color: UIColor.darkGray)
    
    /// 注册按钮
     lazy var registButton:UIButton = UIButton.cz_textButton("注册", fontSize: 16, normalColor: UIColor.orange, highlightedColor: UIColor.darkGray, backgroundImageName: "common_button_white_disable")
    
    /// 登录按钮
     lazy var loginButton:UIButton = UIButton.cz_textButton("登录", fontSize: 16, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange, backgroundImageName: "common_button_white_disable")
   
    
}




// MARK: - 设置界面
extension LTvisitorView{
    
    func setUI(){
        backgroundColor = UIColor.white
        addSubview(iconImage)
        addSubview(MaskiconImage)
        addSubview(houseIconImage)
        addSubview(topLable)
        addSubview(registButton)
        addSubview(loginButton)
        
        ///取消Autoresizing
        for v in subviews {
            v.translatesAutoresizingMaskIntoConstraints = false
        }
        ///icon
        addConstraint(NSLayoutConstraint(
            item: iconImage,
            attribute: .centerX,
            relatedBy: .equal,
            toItem: self,
            attribute: .centerX,
            multiplier: 1.0,
            constant: 0))
        addConstraint(NSLayoutConstraint(
            item: iconImage,
            attribute: .centerY,
            relatedBy: .equal,
            toItem: self,
            attribute: .centerY,
            multiplier: 1.0,
            constant: -60))
        ///小房子
        addConstraint(NSLayoutConstraint(
            item: houseIconImage,
            attribute: .centerX,
            relatedBy: .equal,
            toItem: iconImage,
            attribute: .centerX,
            multiplier: 1.0,
            constant: 0))
        addConstraint(NSLayoutConstraint(
            item: houseIconImage,
            attribute: .centerY,
            relatedBy: .equal,
            toItem: iconImage,
            attribute: .centerY,
            multiplier: 1.0,
            constant: 0))
        
        ///lable
        addConstraint(NSLayoutConstraint(
            item: topLable,
            attribute: .centerX,
            relatedBy: .equal,
            toItem: iconImage,
            attribute: .centerX,
            multiplier: 1.0,
            constant: 0))
        addConstraint(NSLayoutConstraint(
            item: topLable,
            attribute: .top,
            relatedBy: .equal,
            toItem: iconImage,
            attribute: .bottom,
            multiplier: 1.0,
            constant: 20))
        addConstraint(NSLayoutConstraint(
            item: topLable,
            attribute: .width,
            relatedBy: .equal,
            toItem: nil,
            attribute: .notAnAttribute,
            multiplier: 1.0,
            constant: 236))
        //注册按钮
        addConstraint(NSLayoutConstraint(
            item: registButton,
            attribute: .left,
            relatedBy: .equal,
            toItem: topLable,
            attribute: .left,
            multiplier: 1.0,
            constant: 0))
        addConstraint(NSLayoutConstraint(
            item: registButton,
            attribute: .top,
            relatedBy: .equal,
            toItem: topLable,
            attribute: .bottom,
            multiplier: 1.0,
            constant: 20))
        addConstraint(NSLayoutConstraint(
            item: registButton,
            attribute: .width,
            relatedBy: .equal,
            toItem: nil,
            attribute: .notAnAttribute,
            multiplier: 1.0,
            constant: 100))
        //登录按钮
        addConstraint(NSLayoutConstraint(
            item: loginButton,
            attribute: .right,
            relatedBy: .equal,
            toItem: topLable,
            attribute: .right,
            multiplier: 1.0,
            constant: 0))
        addConstraint(NSLayoutConstraint(
            item: loginButton,
            attribute: .top,
            relatedBy: .equal,
            toItem: topLable,
            attribute: .bottom,
            multiplier: 1.0,
            constant: 20))
        addConstraint(NSLayoutConstraint(
            item: loginButton,
            attribute: .width,
            relatedBy: .equal,
            toItem: nil,
            attribute: .notAnAttribute,
            multiplier: 1.0,
            constant: 100))
        //遮罩图像
        
    }
    
}
